import {UploadFile} from "element-plus";

class FileVo{
    public id?:number
    public fileName?:string
    public filePath?:string
    public type?:string
    public format?:string
    public finish ?:boolean
    public number?:number
    public count?:number

    public static toUploadFile(fileVo: FileVo): UploadFile {
        return {
            name: fileVo?.fileName ?? "未命名文件",
            url: `${import.meta.env.VITE_BACKEND_SERVER_URL}/api/file/download/${fileVo?.id}`,
            response: fileVo.id
        } as UploadFile;
    }

    public static getUploadUrl(fileId : string): string {
        return `${import.meta.env.VITE_BACKEND_SERVER_URL}/api/file/download/${fileId}`
    }
}
class FileBo{
    public id?:number
    public fileName?:string
    public filePath?:string
    public type?:string
    public format?:string
    public mdKey?:string
    public number?:number
    public count?:number


    constructor(fileName: string, type: string, format: string, mdKey: string, count: number) {
        this.fileName = fileName;
        this.type = type;
        this.format = format;
        this.mdKey = mdKey;
        this.count = count;
    }
}
class FileSearchBo{
    public id?:number
    public idList?:Array<number>
}

export {FileBo,FileVo,FileSearchBo}